<?php
/**
 * Created by PhpStorm.
 * Author: huangwy
 * Date: 2018/3/16 16:13
 * Version: 1.0
 */

namespace app\admin\model;

use think\Model;
use think\Db;

class Member extends Model
{
    protected $tableName = 'user';
    /**
     * 删除用户
     * @param string $uids
     */
    public function member_del($uids=''){
        if (is_array($uids)) {
            foreach ($uids as $k => $v) {
                if ($v == 1) {//uid为1的禁止删除
                    unset($uids[$k]);
                }
                $uids[$k] = intval($v);
            }
            if (!$uids) {
                return false;
                exit();
            }
        }
        $uids_del = db('user')->where('uid','in',$uids)->delete();
        if ($uids_del) {
            db('auth_group_access')->where('uid','in',$uids)->delete();
            addlog('删除会员UID：' . $uids);
            return true;
        } else {
            return false;
        }
    }

    public function user_group(){
        $usergroup = db('auth_group')->field('id,title')->select();
        return $usergroup;
    }


}